public class PlayerStateBehavior_CatchBall : AbstractPlayerStateBehavior
{
	public static PlayerStateBehavior_CatchBall instance;

	private PlayerStateBehavior_CatchBall()
	{
	}

	public static PlayerStateBehavior_CatchBall getInstance()
	{
		if (instance == null)
		{
			instance = new PlayerStateBehavior_CatchBall();
		}
		return instance;
	}

	public override void enter(Player owner)
	{
		base.enter(owner);
		if (owner.catch_is_normal_catch)
		{
			owner.playAnimation(AnimationName.player_catchball, 1f, -1f);
		}
		else
		{
			if (MathHelper.isInPercent(50f))
			{
				owner.setMirrorAnimation();
			}
			owner.playAnimation(AnimationName.player_catchball2, 1f, 0.2f);
		}
		owner.LookAt(MathHelper.setY(Instance<Ball>.instance.getPosition(), 0f));
		if (owner.teamType == TeamType.USER)
		{
			Instance<Court>.instance.teamUser.player_control.AI.do_offense_findpos();
			Instance<Court>.instance.teamUser.setPlayer_ControlBall(owner);
			if (true)
			{
				Instance<UIGame>.instance.isLockPauseBtn = false;
				Instance<UIGame>.instance.isLockPassBtn = true;
				Instance<UIGame>.instance.isLockShootBtn = true;
				Instance<UIGame>.instance.isLockJoystick = true;
			}
		}
		else
		{
			owner.AI.do_offense_catch();
		}
	}

	public override void fixedUpdate(Player owner)
	{
		base.fixedUpdate(owner);
		if (MathHelper.getSqrDistance(MathHelper.setY(Instance<Ball>.instance.getPosition(), 0f), owner.getPosition()) < 0.5f && !owner.isBallInHand())
		{
			owner.getBallInHand();
		}
		if (owner.IsPlayingAnimation() || !owner.isBallInHand())
		{
			return;
		}
		if (owner.teamType == TeamType.COMPUTER && Instance<Court>.instance.count_FreeThrow <= 0)
		{
			//if (TutorialController.preTutorialType == TutorialType.Game_Shoot)
			//{
			//	owner.AI.time_Stop = 100000f;
			//	Instance<Court>.instance.tutorial.do_tutorial(TutorialType.Game_Steal);
			//}
			owner.AI.do_offense_dribble();
		}
		else
		{
			owner.do_dribble_stay();
			//Instance<Court>.instance.tutorial.do_tutorial(TutorialType.Game_Shoot);
		}
	}

	public override void exit(Player owner)
	{
		base.exit(owner);
		if ((true) && !Instance<Court>.instance.isInState(CourtStateFreeThrow.getInstance()) && owner.teamType == TeamType.USER)
		{
			Instance<UIGame>.instance.isLockPauseBtn = false;
			Instance<UIGame>.instance.isLockPassBtn = false;
			Instance<UIGame>.instance.isLockShootBtn = false;
			Instance<UIGame>.instance.isLockJoystick = false;
		}
		owner.setNormalAnimation();
	}
}
